
page.form.init = function(){
	//初始化grid
	  GirdCtr.gridInit();
	  GirdCtr.buttonBind()
}

//grid控制器
var GirdCtr =  $.extend({},defaultGridConFig,{
   gridInit: function(){
	 var _this = this;
	//创建jqGrid组件
	_this.grid = $("#mainGrid").jqGrid({
		 			datatype: "json",
		 			postData:_this.queryParams(),
		 			url : contextPath+'/act/model/nodeQuery.htm',//组件创建完成之后请求数据的url
					datatype : "json",//请求数据返回的类型。可选json,xml,txt
					colModel : [ //jqGrid每一列的配置信息。包括名字，索引，宽度,对齐方式.....
					             {label:"主键", name : "treeId",sortable:false,hidden:true,key:true},
					             {label:"", name : 'modelId',sortable:false,hidden:true,width : 220,align : "center"}, 
					             {label:"序号", name : 'index',sortable:false,width : 60,align : "center"}, 
					             {label:"名称", name : 'treeName',sortable:false,width : 220,align : "center"}, 
					             {label:"节点类型", name : 'type',sortable:false,width : 80,align : "center",edittype:"select",formatter:'select', editoptions:{value:systemDict.toString(systemDict.nodeType)}} 
					             ],
		            shrinkToFit:false,   
		            autoScroll: true, 
					rowNum : 10,//一页显示多少条
					rowList : [ 10, 20, 30 ],//可供用户选择一页显示多少条
					rownumWidth: 20, //设置显示序号的宽度，默认为25  
					//pager : '#mainGridPager',//表格页脚的占位符(一般是div)的id
					sortname : 'createTime',//初始化的时候排序的字段
					sortorder : "asc",//排序方式,可选desc,asc
					mtype : "post",//向后台请求数据的ajax的类型。可选post,get
					width:page.window.grid.width,
					height:page.window.grid.height8
					
				});
		/*创建jqGrid的操作按钮容器*/
		/*可以控制界面上增删改查的按钮是否显示*/
		$("#mainGrid").jqGrid('navGrid', '#mainGridPager', {edit:false,add:false,del:false,search:false,view:false,refresh:false});
	},
	buttonBind:function(){//控制按钮初始化
	  var _this = this;
	  $("#nodeSettingBtn").bind("click",function(){_this.event.doSetting(_this,this)});
	  $("#nodePeopleBtn").bind("click",function(){_this.event.doPoeple(_this,this)});
	  $("#nodeRoleBtn").bind("click",function(){_this.event.doRole(_this,this)});
	},
	event:{//设置详情
		doSetting:function(_this,btn){
		      var menuId = $(btn).attr("menuId");
		      var node = GirdCtr.getSelectRowData();
		      if(node){
				 // var params = {menuId:menuId,nodeId:node.treeId,modelId:node.modelId,nodeType:node.type}
				  showIframeWindow("节点详情",contextPath+"/act/model/nodeSettingView.htm?menuId="+menuId+"&nodeId="+node.treeId+
						  "&modelId="+node.modelId+"&nodeType="+node.type,null,function(){
					 
				  });
		      }
	  },
	  doPoeple:function(_this,btn){//设置人员
		  var menuId = $(btn).attr("menuId");
		  var node = GirdCtr.getSelectRowData();
		  if(node){
			  //var params = {menuId:menuId,nodeId:node.treeId,modelId:node.modelId,nodeType:node.type}
			  showIframeWindow("人员设置",contextPath+"/act/model/nodePeopleView.htm?menuId="+menuId+"&nodeId="+node.treeId+
					  "&modelId="+node.modelId+"&nodeType="+node.type,null,function(){
				 
			  },true);
		  }else{
			  layer.msg("选择需要修改的数据");
		  }
	  },
	  doRole:function(_this,btn){//设置角色
		  var menuId = $(btn).attr("menuId");
		  var node = GirdCtr.getSelectRowData();
		  if(node){
			  //var params = {menuId:menuId,nodeId:node.treeId,modelId:node.modelId,nodeType:node.type}
			  showIframeWindow("角色设置",contextPath+"/act/model/nodeRoleView.htm?menuId="+menuId+"&nodeId="+node.treeId+
					  "&modelId="+node.modelId+"&nodeType="+node.type,null,function(){
				 
			  },true);
		  }else{
			  layer.msg("选择需要修改的数据");
		  }
	  }
	}
});

